package com.d0313;

public abstract class Shape {
    abstract void area();
    abstract void perimeter();
}//圆形
class Circular extends Shape{
    int r=3;
    @Override
    void  area() {
        double a=r*r*3.14;
        System.out.println("圆形的面积:"+a);
    }

    @Override
    void  perimeter() {
        double p=2*3.14*r;
        System.out.println("圆形的周长:"+p);
    }

    public static void main(String[] args) {
        Circular circular=new Circular();
        Rectangle rectangle=new Rectangle();
        circular.perimeter();
        circular.area();
        rectangle.area();
        rectangle.perimeter();
    }
}
//矩形
class Rectangle extends Shape{
     int d=4;
     int w=5;
    @Override
    void area() {
        int area=d*w;
        System.out.println("长方形的面积:"+area);
    }

    @Override
    void perimeter() {
        int p=2*d+2*w;
        System.out.println("长方形的周长:"+p);
    }
}